// 路由注册页面
const routerList = [
  {
    path: "/userHome",
    component: () => import("@/views/user/userHome/index.vue"),
    name: "UserHome",
    meta: {
      title: "系统主页",
    },
  },
  {
    path: "/basicSettings",
    component: () => import("@/views/user/basicSettings/index.vue"),
    name: "BasicSettings",
    meta: {
      title: "基本设置",
    },
  },
];


const userList = getChildren(routerList);
// 遍历数组 把children里面的数据都遍历到第一级 children 层级不确定
function getChildren(arr) {
  let children = [];
  arr.forEach((item) => {
    if (!item.children) {
      children.push(item);
    }
    if (item.children) {
      children = children.concat(getChildren(item.children));
    }
  });
  return children;
}

export { userList };